import request from "@/utils/request";

// 分类列表
export function listCategory(query) {
  return request({
    url: "/system/category/listAll",
    method: "get",
    params: query,
  });
}

// 查询分类详细
export function getCategory(categoryId) {
  return request({
    url: "/system/category/" + categoryId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
  });
}

// 新增分类
export function addCategory(data) {
  return request({
    url: "/system/category/add",
    method: "post",
    data: data,
  });
}

// 编辑标识分类
export function updateCategory(data) {
  return request({
    url: "/system/category/edit",
    method: "post",
    data: data,
  });
}

// 删除
export function delCategory(categoryId) {
  return request({
    url: "/system/category/remove/" + categoryId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
  });
}

// 导出
export function exportCategory(query) {
  return request({
    url: "/category/export",
    method: "get",
    params: query,
  });
}

// 获取标识分类下拉树列表
export function treeselectCategory(query) {
  return request({
    url: "/system/category/treeselect",
    method: "get",
    params: query,
  });
}

//  ------------------------------------------------------------

// 分类列表
export function firstListCategory(query) {
  return request({
    url: "/system/category/first/levet/list",
    method: "get",
    params: query,
  });
}

// 查询分类详细
export function firstGetCategory(query) {
  return request({
    url: "/system/category/first/levet/get",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
    params: query,
  });
}

// 新增分类
export function firstAddCategory(data) {
  return request({
    url: "/system/category/first/levet/add",
    method: "post",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    params: data,
  });
}

// 编辑标识分类
export function firstUpdateCategory(data) {
  return request({
    url: "/system/category/first/levet/edit",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    params: data,
  });
}

// 删除
export function firstDelCategory(categoryId) {
  return request({
    url: "/system/category/first/levet/remove/" + categoryId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
  });
}
